package com.wlyuan.open.scanner.utils.enums.user;

import com.wlyuan.core.marker.NamedValue;
import com.wlyuan.core.marker.NamedValueMap;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @author lijing
 * @description 用户角色值新老对应关系
 */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum UserRoleEnum implements NamedValue<Integer> {

    //管理员
    ROLE_ADMIN(256, Arrays.asList(1L), "管理员"),
    //客服
    ROLE_KF(2, Arrays.asList(10L), "客服"),
    //运营
    ROLE_YY(1, Arrays.asList(11L), "运营"),
    //业务员
    ROLE_YWY(512, Arrays.asList(12L), "业务员"),
    //采购
    ROLE_CG(32, Arrays.asList(13L), "采购"),
    //财务
    ROLE_CW(8, Arrays.asList(14L), "财务"),
    //决策者
    ROLE_JCZ(128, Arrays.asList(15L), "决策者"),
    //同步操作员
    ROLE_SYNC(1024, Arrays.asList(10L, 11L, 17L), "同步操作员"),
    ;

    private final Integer value;
    private final List<Long> newValue;
    private final String name;

    private static final Map<Integer, UserRoleEnum> MAP = new NamedValueMap<>(UserRoleEnum.class);

    public static UserRoleEnum fromValue(Integer value) {
        return MAP.get(value);
    }
}
